<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //  将"i love javascript very much"的每个单词的第一个字母，变为大写。
        // toUpperCase()   把字符串转换为大写
        var str = "i love javascript very much";
        var Ustr = "";
        var Nstr = "";
        var arr = str.split(" ");

        for(var i = 0;i<arr.length;i++){
            Ustr = arr[i].slice(0,1).toUpperCase();
            Nstr = arr[i].slice(1,arr[i].length);

            var end = Ustr.concat(Nstr);
            arr[i] = end;

        }
        console.log(arr.join(" "));
    </script>
</head>
<body>
    
</body>
</html>